<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:t="http://myfaces.apache.org/tomahawk">

<ui:composition template="/template.xhtml">
	<ui:define name="head">
		<link
			href="#{facesContext.externalContext.requestContextPath}/css/cv.css"
			rel="stylesheet" type="text/css" />
		<link
			href="#{facesContext.externalContext.requestContextPath}/css/rf/accordion.css"
			rel="stylesheet" type="text/css" />
		<link
			href="#{facesContext.externalContext.requestContextPath}/css/rf/calendar.css"
			rel="stylesheet" type="text/css" />
		<link
			href="#{facesContext.externalContext.requestContextPath}/css/rf/panel.css"
			rel="stylesheet" type="text/css" />
		<link
			href="#{facesContext.externalContext.requestContextPath}/css/rf/popupPanel.css"
			rel="stylesheet" type="text/css" />
		<link
			href="#{facesContext.externalContext.requestContextPath}/css/rf/collapsiblePanel.css"
			rel="stylesheet" type="text/css" />
		<link
			href="#{facesContext.externalContext.requestContextPath}/css/rf/editor.css"
			rel="stylesheet" type="text/css" />
	</ui:define>
	<ui:define name="content">
		<div id="head" align="center">
			<h:outputText value="#{label.createcv}" style="font-size: 30px;" />
			<hr></hr>
		</div>
		<h:form id="cvForm" enctype="multipart/form-data">
			<div>
				<div id="photo">
					<h:graphicImage rendered="#{cvAction.cv.cvPicture eq null}"
						value="/img/default_user.png" />
					<br />
					<a4j:mediaOutput rendered="#{cvAction.cv.cvPicture ne null}"
						element="img" cacheable="false" session="true" id="img"
						createContent="#{cvAction.paint}"
						value="#{cvAction.cv.cvPicture.id}" alt="img"
						mimeType="#{cvAction.cv.cvPicture.mimeType}" />
					<t:inputFileUpload rendered="#{not cvAction.preview}"
						value="#{cvAction.cvPicture}" />
				</div>
				<div id="personalInfo">
					<h:panelGrid columns="2" columnClasses="alignTop, alignTop">
						<h:panelGrid columns="2" columnClasses="alignRight"
							style="margin-right: 20px;">
							<h:outputText styleClass="commonLabel" value="#{label.name}" />
							<h:inputText id="nameField" disabled="#{cvAction.preview}"
								value="#{cvAction.cv.personalInformation.name}">
								<f:validateLength minimum="3" />
							</h:inputText>

							<h:outputText styleClass="commonLabel" value="#{label.middleName}" />
							<h:inputText disabled="#{cvAction.preview}"
								value="#{cvAction.cv.personalInformation.middleName}" />

							<h:outputText styleClass="commonLabel" value="#{label.lastName}" />
							<h:inputText disabled="#{cvAction.preview}"
								value="#{cvAction.cv.personalInformation.lastName}" />

							<h:outputText styleClass="commonLabel" value="#{label.title}" />
							<h:inputText disabled="#{cvAction.preview}"
								value="#{cvAction.cv.personalInformation.title}" />

							<h:outputText styleClass="commonLabel"
								rendered="#{cvAction.preview}" value="#{label.viewIn}" />
							<h:outputText styleClass="commonLabel"
								rendered="#{not cvAction.preview}" value="#{label.editIn}" />
							<h:selectOneMenu style="width: 100%;"
								value="#{cvAction.currentLanguage}">
								<f:selectItems
									value="#{codelistBean.getCodelistValuesAsSelectItems('2', 'en')}" />
							</h:selectOneMenu>
						</h:panelGrid>

						<h:panelGrid columns="2" columnClasses="alignRight">
							<h:outputText styleClass="commonLabel" value="#{label.datеOfBirth}" />
							<rich:calendar
								value="#{cvAction.cv.personalInformation.dateOfBirth}"
								id="calendar" locale="en" popup="true" datePattern="dd/MMM/yyyy"
								disabled="#{cvAction.preview}" showApplyButton="false" />

							<h:outputText styleClass="commonLabel" value="#{label.nationality}" />
							<h:inputText disabled="#{cvAction.preview}"
								value="#{cvAction.cv.personalInformation.nationality}" />

							<h:outputText styleClass="commonLabel" value="#{label.civilStatus}" />
							<h:inputText disabled="#{cvAction.preview}"
								value="#{cvAction.cv.personalInformation.civilStatus}" />
						</h:panelGrid>
					</h:panelGrid>
				</div>
			</div>
			<div style="clear: both;" />
			<div id="info">
				<rich:editor id="editor" rendered="#{not cvAction.preview}"
					toolbar="basic" value="#{cvAction.cv.personalInformation.info}"
					style="resize: none; margin-bottom: 1em; margin-top: 1em;">
				</rich:editor>
				<rich:panel header="Additional Information"
					rendered="#{not empty cvAction.cv.personalInformation.info and cvAction.preview}">
					<h:outputText escape="false"
						value="#{cvAction.cv.personalInformation.info}" />
				</rich:panel>
			</div>
			<div style="margin-bottom: 50px;">
				<f:subview id="education">
					<ui:include src="/pages/fragments/tables/educationTable.xhtml">
						<ui:param name="helper" value="#{cvAction.educationTableHelper}" />
						<ui:param name="preview" value="#{cvAction.preview}" />
					</ui:include>
				</f:subview>
				<f:subview id="languageSkill">
					<ui:include src="/pages/fragments/tables/languageSkillTable.xhtml">
						<ui:param name="helper" value="#{cvAction.langSkillTableHelper}" />
						<ui:param name="preview" value="#{cvAction.preview}" />
					</ui:include>
				</f:subview>
				<f:subview id="membership">
					<ui:include
						src="/pages/fragments/tables/membershipOfProBodiesTable.xhtml">
						<ui:param name="helper" value="#{cvAction.membershipTableHelper}" />
						<ui:param name="preview" value="#{cvAction.preview}" />
					</ui:include>
				</f:subview>
				<f:subview id="others">
					<ui:include src="/pages/fragments/tables/othersTable.xhtml">
						<ui:param name="helper" value="#{cvAction.othersTableHelper}" />
						<ui:param name="preview" value="#{cvAction.preview}" />
					</ui:include>
				</f:subview>
				<f:subview id="yearsWithinCompany">
					<ui:include
						src="/pages/fragments/tables/yearsWithinACompanyTable.xhtml">
						<ui:param name="helper"
							value="#{cvAction.yearsWithinCompanyTableHelper}" />
						<ui:param name="preview" value="#{cvAction.preview}" />
					</ui:include>
				</f:subview>
				<f:subview id="keyQualifications">
					<ui:include
						src="/pages/fragments/tables/keyQualificationTable.xhtml">
						<ui:param name="helper"
							value="#{cvAction.keyQualificationsTableHelper}" />
						<ui:param name="preview" value="#{cvAction.preview}" />
					</ui:include>
				</f:subview>
				<f:subview id="otherSkills">
					<ui:include src="/pages/fragments/tables/otherSkillsTable.xhtml">
						<ui:param name="helper" value="#{cvAction.otherSkillsTableHelper}" />
						<ui:param name="preview" value="#{cvAction.preview}" />
					</ui:include>
				</f:subview>
				<f:subview id="positions">
					<ui:include src="/pages/fragments/tables/positionsTable.xhtml">
						<ui:param name="helper" value="#{cvAction.positionsTableHelper}" />
						<ui:param name="preview" value="#{cvAction.preview}" />
					</ui:include>
				</f:subview>
			</div>
			<h:panelGroup id="actionsDiv"
				styleClass="#{cvAction.fixedActionDiv ? 'actionsDivFixed' : 'actionsDiv'}">
				<div style="float: left;">
					<h:commandButton rendered="#{not cvAction.preview}"
						action="#{cvAction.actionSaveCv()}" value="#{label.save}" />
					<h:commandButton rendered="#{cvAction.preview}"
						action="#{cvAction.actionEditCv()}" value="#{label.edit}" />
					<h:commandButton rendered="#{not cvAction.preview}"
						immediate="true" action="#{cvAction.actionCancel()}"
						value="#{label.cancel}" />
				</div>
				<div style="float: right;">
					<h:outputLabel styleClass="commonLabel" value="#{label.fixInPlace}"
						for="fixActionDiv" />
					<h:selectBooleanCheckbox id="fixActionDiv"
						value="#{cvAction.fixedActionDiv}">
						<a4j:ajax immediate="true" render="actionsDiv" />
					</h:selectBooleanCheckbox>
				</div>
				<div style="clear: both;" />
			</h:panelGroup>
		</h:form>
	</ui:define>
</ui:composition>
</html>
